using Abp.Domain.Services;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;


namespace SOEI.Solution.Integratedes.Organization.DomainService
{
    /// <summary>
    /// 领域服务接口定义
    ///</summary>
    public interface IOEconomyPersonManager : IDomainService
    {
        #region -------------------------------------------------辅助工具生成----------------------------------------------
        /// <summary>
        /// 返回表达式数的实体信息即IQueryable类型(可选择部分字段)
        /// </summary>
        /// <returns>IQueryable</returns>
        IQueryable<OEconomyPerson> QueryEntityListAsNoTracking();
        /// <summary>
        /// 返回表达式数的实体信息即IQueryable类型
        /// </summary>
        /// <returns>IQueryable</returns>
        IQueryable<OEconomyPerson> Query();
        /// <summary>
        /// 返回性能更好的IQueryable类型，但不包含EF Core跟踪标记
        /// </summary>
        /// <returns>IQueryable</returns>
        IQueryable<OEconomyPerson> QueryAsNoTracking();
        /// <summary>
        /// 【OEconomyPerson】根据Id查询实体信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns>实体</returns>
        Task<OEconomyPerson> FindByIdAsync(string id);
        /// <summary>
        /// 【OEconomyPerson】检查实体是否存在
        /// </summary>
        /// <returns>是否成功</returns>
        Task<bool> IsExistAsync(string id);
        /// <summary>
        /// 【OEconomyPerson】添加实体
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        Task<OEconomyPerson> CreateAsync(OEconomyPerson entity);
        /// <summary>
        /// 【OEconomyPerson】修改实体
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        Task UpdateAsync(OEconomyPerson entity);
        /// <summary>
        /// 【OEconomyPerson】删除实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task DeleteAsync(string id);
        /// <summary>
        /// 【OEconomyPerson】批量删除
        /// </summary>
        /// <param name="input">Id的集合</param>
        /// <returns></returns>
        Task BatchDelete(List<string> input);
        #endregion

        #region -------------------------------------------------用户自定义------------------------------------------------
        /*请在此扩展领域服务接口*/

        /// <summary>
        /// 获取新的序列编码
        /// </summary>
        /// <returns></returns>
        string GetNewSequenceCode();

        /// <summary>
        /// 联合查询的结果
        /// </summary>
        /// <returns></returns>
        IQueryable<OEconomyPerson> QueryUnionEntityListAsNoTracking();

        /// <summary>
        /// 【OrganiPerson】提交初始化备案
        /// </summary>
        /// <param name="id">要提交的机构Id</param>
        /// <returns></returns>
        Task SubmitInitRecord(string OriginalNumber);

        /// <summary>
        /// 指定的机构编号下增加人员
        /// </summary>
        /// <param name="OriginalNumber"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        Task AcceptPerson(string OriginalNumber, string PersonID);
        #endregion

        #region -------------------------------------------------判断逻辑------------------------------------------------
        /// <summary>
        /// 获取指定变好的管理员信息
        /// </summary>
        /// <param name="PersonID"></param>
        /// <returns></returns>
        Task<OEconomyAdmin> GetAdminPersonEntityAsync(string PersonID);

        /// <summary>
        /// 生成管理员
        /// </summary>
        /// <param name="OEconomyAdmin"></param>
        /// <returns></returns>
        Task<OEconomyAdmin> GenerateAdminAccount(OEconomyAdmin OEconomyAdmin);

        /// <summary>
        /// 指定编号的经济机构是否存在管理员（Zhxt）
        /// </summary>
        /// <param name="OriginalNumber"></param>
        /// <returns></returns>

        Task<bool> IsExistAdminAccount(string OriginalNumber);

        #endregion

        #region -------------------------------------------------判断逻辑------------------------------------------------

        /// <summary>
        /// 指定机构的人员是否存人员变更记录
        /// </summary>
        /// <param name="OriginalNumber"></param>
        /// <param name="PersonID"></param>
        /// <returns></returns>
        Task<bool> IsExistPersonChange(string OriginalNumber, string PersonID);

        #endregion

        /// <summary>
        /// 查询关联了新模式中带承诺书的人员清单
        /// </summary>
        /// <returns></returns>
        IQueryable<OEconomyPerson> QueryUnionEntityForBledgeBookListAsNoTracking();
    }
}
